package com.wanxi.service.impl;

import com.wanxi.dao.NewsDao;
import com.wanxi.dao.impl.NewsDaoImpl;
import com.wanxi.dto.NewsDTO;
import com.wanxi.entity.NewsEntity;
import com.wanxi.service.NewsService;
import com.wanxi.util.Tool;
import com.wanxi.vo.HomeVO;

import java.util.List;

public class NewsServcieImpl implements NewsService {
    private NewsDao newsDao = new NewsDaoImpl();

    @Override
    public List<NewsDTO> find(HomeVO homeVO) {
        NewsEntity newsEntity = new NewsEntity();
        newsEntity.setPage(homeVO.getPageNews());
        newsEntity.setLimit(homeVO.getLimitNews());
        List<NewsEntity> newsEntityList = newsDao.find(newsEntity);

        return Tool.copy(newsEntityList, NewsDTO.class);
    }
}
